Page({
  data: {
    registrationCount: 0
  },

  onLoad: function () {
    this.fetchRegistrationCount();
    this.interval = setInterval(() => {
      this.fetchRegistrationCount();
    }, 5000); // 每5秒更新一次
  },

  onUnload: function () {
    clearInterval(this.interval); // 页面卸载时清除定时器
  },

  fetchRegistrationCount: function () {
    // 模拟异步请求，实际中应替换为真实接口调用
    setTimeout(() => {
      const newCount = Math.floor(Math.random() * 100);
      this.setData({
        registrationCount: newCount
      });
    }, 1000);
  }
});